<?php
namespace app\admin\controller;
use \think\Controller;
class Member extends Base
{

	public function index()
	{

		$memberObj = model('Member');

		$data = $memberObj->lists();
		$page = '';

		$this->assign('page', $page);
		$this->assign('list', $data ['list']);
		return view();
	}

	public function add()
	{

		if($this->isPost()) {
			$post      = input();
			$memberObj = model('Member');
			
			$result    = $memberObj->updates($post);

			if($result >= 1) {
				$this->success('操作成功', url('index'));
			} else {
				$this->success('操作失败');
			}

		} else {
			return view('edit');
		}
	}

	public function edit($id)
	{
		if($this->isPost()) {
			$post      = input();
			$memberObj = model('Member');
			
			$result    = $memberObj->updates($post);

			if($result >= 1) {
				$this->success('操作成功', url('index'));
			} else {
				$this->success('操作失败');
			}

		} else {
			$data = model('Member')->one($id);
			$this->assign('data', $data);
			return view('edit');
		}

	}

	public function del()
	{}

	public function dels()
	{}

}